{% extends 'events/registration/management/_regform_base.html' %}

{% block back_button_url -%}
    {{ url_for('.manage_regform', regform) }}
{%- endblock %}

{% block subtitle %}
    {% trans title=regform.title -%}
        Invitations for "{{ title }}"
    {%- endtrans %}
{% endblock %}

{% block content %}
    {% if not regform.limit_reached %}
        <div class="action-box hide-if-locked">
            <div class="section">
                <div class="icon icon-users"></div>
                <div class="text">
                    <div class="label">
                        {% trans %}Invite people{% endtrans %}
                    </div>
                    <div>
                        {% trans %}Invite people to register for your event.{% endtrans %}
                    </div>
                </div>
                <div class="toolbar">
                    {{ template_hook('registration-invite-options', event=event, regform=regform) }}
                    <button class="i-button icon-user arrow js-dropdown" data-toggle="dropdown">
                        {% trans %}Invite{% endtrans %}
                    </button>
                    <ul class="i-dropdown">
                        <li>
                            <a class="js-invite-user" data-href="{{ url_for('.invite', regform) }}"
                               data-title="{% trans %}Invite user to register{% endtrans %}" href="#">
                                {% trans %}New user{% endtrans %}
                            </a>
                        </li>
                        <li>
                            <a class="js-invite-user" data-href="{{ url_for('.invite', regform, existing=True) }}"
                               data-title="{% trans %}Invite user to register{% endtrans %}" href="#">
                                {% trans %}Indico users{% endtrans %}
                            </a>
                        </li>
                    </ul>
                    <button class="i-button js-invite-user" data-href="{{ url_for('.import', regform) }}"
                       data-title="{% trans %}Import invitations from a CSV File{% endtrans %}">
                        {% trans %}Import{% endtrans %}
                    </button>
                </div>
            </div>
            <div class="section">
                <div class="icon icon-mail"></div>
                <div class="text">
                    <div class="label">
                        {% trans %}Remind pending invitees{% endtrans %}
                    </div>
                    {% trans %}Send email reminders to users who have not yet registered.{% endtrans %}
                </div>
                <div class="toolbar" id="email-all-pending-invitations-container"></div>
            </div>
        </div>
    {% endif %}

    <div id="invitation-list-container"></div>

    <script>
        setupInvitationPage({
            eventId: {{ event.id | tojson }},
            regformId: {{ regform.id | tojson }},
            hasPendingInvitations: {{ has_pending_invitations | tojson }},
            invitations: {{ invitations_list | tojson }},
        });
    </script>
{% endblock %}
